﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IceDog.Lib.Poker.PokerClient
{
    public static class Helper
    {
        /// <summary>
        /// 获取符合条件的输入
        /// </summary>
        /// <param name="tips"></param>
        /// <param name="conditionList"></param>
        /// <returns></returns>
        public static string GetRightInput(string tips, string[] conditionList)
        {
            bool inputOk = false;
            var count = 0;
            Console.WriteLine(tips);
            do
            {
                if (count != 0)
                {
                    Console.WriteLine("输入错误，请重新输入：");
                }
                var input = Console.ReadLine().ToLowerInvariant();
                foreach (string str in conditionList)
                {
                    if (str.ToLowerInvariant().Equals(input))
                    {
                        inputOk = true;
                        return input;
                    }
                }
                count++;
            } while (!inputOk);
            return string.Empty;
        }
    }
}
